<template>
	<view class="page">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex setPassword_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between setPassword_fd0_0'>
				<view class='flex flex-wrap align-center setPassword_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<image class='setPassword_fd0_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"56.png"'></image>
				</view>
				<text class='setPassword_fd0_0_c1'>修改密码</text>
				<view class='flex align-center justify-end setPassword_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch setPassword_flex_1">
			<view class='flex flex-wrap align-center setPassword_fd1_0'>
				<text class='setPassword_fd1_0_c0'>新密码</text>
				<input class='flex-sub setPassword_fd1_0_c1' type="text" placeholder="请输入新密码" confirm-type="done"
					:maxlength="12" :password='true' placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx"
					v-model="newPassword" />
			</view>
			<view class='flex flex-wrap align-center setPassword_fd1_1'>
				<text class='setPassword_fd1_1_c0'>确认新密码</text>
				<input class='flex-sub setPassword_fd1_1_c1' type="text" placeholder="请再次输入新密码" confirm-type="done"
					:maxlength="12" :password='true' placeholder-style="color:rgba(153, 153, 153, 1);font-size:32rpx"
					v-model="confirmNewPassword" />
			</view>
			<button class='setPassword_fd1_2' @tap.stop="getcheck()">完成</button>
		</view>
		<!---flex布局flex布局结束-->

	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},

		data() {
			return {
				"newPassword": "",
				"confirmNewPassword": ""
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//校检
			getcheck() {
				if (!validate(this.newPassword, 'require')) {
					this.$message.info('新密码不能为空');
					return false;
				}
				if (!validate(this.newPassword, 'password')) {
					this.$message.info('新密码格式不正确');
					return false;
				}
				if (!validate(this.confirmNewPassword, 'require')) {
					this.$message.info('确认新密码不能为空');
					return false;
				}
				if (!validate(this.confirmNewPassword, 'password')) {
					this.$message.info('确认新密码格式不正确');
					return false;
				}
				if (!(this.newPassword == this.confirmNewPassword)) {
					this.$message.info('新密码与确认新密码不一致');
					return false;
				}
				this.$api.post(global.apiUrls.post63119b366040c, {
						password: this.newPassword,
						do_password: this.confirmNewPassword 
				}).then(res => {
					if (res.data.code == 1) {
						this.$urouter.reLaunch(`/pages/tabBar/login/login`);
					} else {
						this.$message.info(res.data.msg);
					}
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.setPassword_fd1_0 {
		border-bottom: 1px solid #eee;
		margin: 0rpx 0rpx 0rpx 32rpx;
		padding: 0rpx 32rpx 0rpx 0rpx;
		height: 110rpx;
	}

	.setPassword_fd1_0_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
		margin: 0rpx 40rpx 0rpx 0rpx;
	}

	.setPassword_fd1_0_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.setPassword_fd1_1 {
		border-bottom: 1px solid #eee;
		margin: 0rpx 0rpx 0rpx 32rpx;
		padding: 0rpx 32rpx 0rpx 0rpx;
		height: 110rpx;
	}

	.setPassword_fd1_1_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
		margin: 0rpx 40rpx 0rpx 0rpx;
	}

	.setPassword_fd1_1_c1 {
		line-height: 45rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.setPassword_fd1_2 {
		background: rgba(44, 143, 255, 1);
		background-size: 100% !important;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		font-size: 32rpx;
		color: #fff;
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-weight: 500;
		margin: 80rpx 32rpx 0rpx 32rpx;
	}

	.setPassword_flex_1 {
		background: #fff;
		background-size: 100% !important;
		font-size: 32rpx;
		background-size: 100% auto !important;
	}

	.setPassword_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.setPassword_fd0_0_c0 {
		width: 40rpx;
		height: 40rpx;
	}

	.setPassword_fd0_0_c0_c0 {
		width: 18rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.setPassword_fd0_0_c1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.setPassword_fd0_0_c2 {
		width: 40rpx;
		height: 40rpx;
	}

	.setPassword_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		background-size: 100% !important;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.page {
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}
</style>
